<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button class="bts bt btss">ok1</button>
		<button class="bts">ok2</button>
		<button  class="bts bt">ok3</button>
		<div id="dv1">
			<button  class="bt btss">ok4</button>
		</div>
	</body>
	<script>
	// document在定位元素时，可以全局查找，也可以在指定区域的内部进行定位
	// 默认全局查找
	// var bts=document.getElementsByTagName("button");
	// 可以查询指定区间内的元素
	var bts=document.getElementById("dv1").getElementsByTagName("button")
	for(var i=0;i<bts.length;i++){
		bts[i].style.backgroundColor="red"
	}
	var btsByClassName=document.getElementsByClassName("bts bt");
	for(var a=0;a<btsByClassName.length;a++){
		btsByClassName[a].style.color="yellow"
	}
	
	</script>
</html>
